﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VirtualOrg.DB;
using VirtualOrg.Helper;

namespace VirtualOrg.Web
{
    public partial class FormForgotUser : OboutInc.oboutAJAXPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public string SendPassword(string username, string email)
        {
            MessageBox msgbox = null;
            string result = "";
            try
            {
                using (DbStoreDataContext dataContext = new DbStoreDataContext())
                {
                    string passwordResult = dataContext.GetUserPassword(username, email);
                    if (!string.IsNullOrWhiteSpace(passwordResult))
                    {
                        SiteHelper.SendEmail("", "", "");
                        msgbox = new MessageBox("Password sent to your email id!!");
                    }
                    else
                    {
                        msgbox = new MessageBox("Invalid username or email id!!");
                    }
                }
            }
            catch
            {
                msgbox = new MessageBox("Error while sending password!!");
            }

            result = msgbox.ReturnObject();
            return result;
        }
    }
}